﻿/**
 *  Distributed as part of Free.iso8583
 *  
 *  Free.iso8583 is ISO 8583 Message Processor library that makes message parsing/compiling esier.
 *  It will convert ISO 8583 message to a model object and vice versa. So, the other parts of
 *  application will only do the rest effort to make business process done.
 *  
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License or (at your option) any later version. 
 *  See http://gnu.org/licenses/lgpl.html
 *
 *  Developed by AT Mulyana (atmulyana@yahoo.com) 2009-2010
 *  The latest update can be found at sourceforge.net
 **/
using System;
using System.Collections.Generic;
using System.Text;

namespace Free.iso8583
{
    public class ConstantBytesCode
    {
        private byte _byte;
        private byte[] _bytes;
        private String _string;

        public ConstantBytesCode(byte byteVal)
        {
            _byte = byteVal;
            _bytes = new byte[] { byteVal };
            _string = MessageUtility.HexToString(byteVal);
        }
        public ConstantBytesCode(byte[] bytes)
        {
            _byte = 0;
            _bytes = bytes;
            _string = MessageUtility.HexToString(bytes);
        }

        public byte Byte
        {
            get
            {
                return _byte;
            }
        }
        public byte[] Bytes
        {
            get
            {
                return _bytes!=null ? _bytes : new byte[] {_byte};
            }
        }
        public String String
        {
            get
            {
                return _string;
            }
        }

        
    }
}
